<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@include file="/WEB-INF/page/share/taglib.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>地址列表</title>
<c:if test="${empty requestScope.message}">
	<script type="text/javascript" language="javaScript">
		function checkIt(){
			var objForm = document.forms[0];
			var form = opener.document.forms[0];
			//alert(form);
			if (form){
				//alert(objForm.dicId.value);
				form.parentId.value = objForm.dicId.value;
				form.parent.value = objForm.dicName.value;
				//alert(objForm.dicName.value);
			}
			window.close();
		}
		function getDicName(dicId,strDicName){
			var objForm = document.forms[0];
			objForm.dicId.value = dicId;
			objForm.dicName.value = strDicName;
			//alert("dicId.value is:"+objForm.dicId.value+";  dicName.value is:"+objForm.dicName.value);
		}
	</script>
</c:if>
</head>
<body>
	<form method="post" name="main" action="">
		<input type="hidden" name="dicId">
	  	<input type="hidden" name="dicName">
		产品类别列表,请选择分类:<br>
		导航:<a href='<html:rewrite action="/address/manage"/>?method=selectUI&&message=${requestScope.message}'>顶级目录</a><br/>
		<c:forEach items="${requestScope.addresses}" var="address" varStatus="loop">
			<c:if test="${empty requestScope.message}">
				<input type="radio"  name="" onclick="getDicName('${address.addressId}','${address.name }')"/>
			</c:if>
			<c:if test="${fn:length(address.childs)>0}">
				<a href='<html:rewrite action="/address/manage"/>?method=selectUI&&addressid=${address.addressId}&&message=${requestScope.message}'>${address.name}</a>&nbsp;&nbsp;
			</c:if>
			<c:if test="${fn:length(address.childs)==0}">
				${address.name}&nbsp;&nbsp; 
			</c:if>
			<c:if test="${!empty requestScope.message}">
				<a href="<html:rewrite action="/address/manage" />?method=editUI&&addressid=${address.addressId}">修改</a>&nbsp;&nbsp;
			</c:if>
			<c:if test="${loop.count % 5 ==0}"><br/></c:if>
		</c:forEach>
		<br/>
		<c:if test="${!empty requestScope.message}">
			
			<a href="<html:rewrite action="/address/manage" />?method=addUI">添加</a>
		</c:if>
		<c:if test="${empty requestScope.message}">
			<br></br>
			<input type='button' name='create' value=" 确 认 " onClick="javascript:checkIt()">
			<input type='button' name="cancel" onClick="javaScript:window.close()" value=" 取 消 "> 
		</c:if>
	</form>
</body>
</html>